home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / lib / linux-boot-probes / 50mounted-tests
Text File  |  2008-08-25  |  953b  |  43 lines

  1. #!/bin/sh
  2. # Sub-tests that require a mounted partition.
  3. . /usr/share/os-prober/common.sh
  4. set -e
  5.  
  6. partition=$1
  7.  
  8. tmpmnt=/var/lib/os-prober/mount
  9. if [ ! -d $tmpmnt ]; then
  10.     mkdir $tmpmnt
  11. fi
  12.  
  13. for type in $(grep -v nodev /proc/filesystems); do
  14.     if mount -o ro -t $type $partition $tmpmnt 2>/dev/null; then
  15.         mountboot="$(linux_mount_boot "$partition" "$tmpmnt")"
  16.         bootpart="${mountboot%% *}"
  17.         mounted="${mountboot#* }"
  18.         
  19.         for test in /usr/lib/linux-boot-probes/mounted/*; do
  20.             if [ -f $test ] && [ -x $test ]; then
  21.                 debug "running $test $partition $bootpart $tmpmnt $type"
  22.                 if $test $partition $bootpart $tmpmnt $type; then
  23.                     debug "$test succeeded"
  24.                     repeat_umount $tmpmnt/boot 2>/dev/null || true     
  25.                     repeat_umount $tmpmnt
  26.                     rmdir $tmpmnt || true
  27.                     exit 0
  28.                 fi
  29.             fi
  30.         done
  31.         
  32.         repeat_umount $tmpmnt/boot 2>/dev/null || true     
  33.         repeat_umount $tmpmnt
  34.  
  35.         break
  36.     fi
  37. done
  38.  
  39. rmdir $tmpmnt || true
  40.  
  41. # No tests found anything.
  42. exit 1
  43.